@8btc/mditor 0.0.7 → 0.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.css +56 -2
- package/dist/index.d.ts +9 -0
- package/dist/index.js +3289 -2841
- package/dist/index.min.js +1 -1
- package/dist/method.d.ts +14 -10
- package/dist/method.js +527 -3
- package/dist/method.min.js +1 -1
- package/dist/ts/util/editorCommonEvent.d.ts +3 -2
- package/dist/ts/wysiwyg/index.d.ts +29 -0
- package/dist/types/index.d.ts +18 -2
- package/package.json +1 -1
- package/src/assets/less/_line-number.less +6 -1
- package/src/assets/less/_selection-popover.less +148 -0
- package/src/assets/less/_selection-tag.less +38 -0
- package/src/assets/less/index.less +2 -0
- package/src/index.ts +58 -3
- package/src/method.ts +1 -1
- package/src/ts/ir/index.ts +1 -1
- package/src/ts/ir/process.ts +1 -1
- package/src/ts/markdown/selectionRender.ts +28 -0
- package/src/ts/preview/index.ts +6 -5
- package/src/ts/sv/index.ts +1 -1
- package/src/ts/sv/process.ts +1 -1
- package/src/ts/ui/initUI.ts +4 -2
- package/src/ts/util/Options.ts +8 -1
- package/src/ts/util/editorCommonEvent.ts +296 -184
- package/src/ts/util/processCode.ts +43 -24
- package/src/ts/wysiwyg/afterRenderEvent.ts +1 -1
- package/src/ts/wysiwyg/index.ts +509 -119
- package/src/ts/wysiwyg/renderDomByMd.ts +1 -1
package/dist/index.css
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Vditor v0.0.
|
|
2
|
+
* Vditor v0.0.8 - A markdown editor written in TypeScript.
|
|
3
3
|
*
|
|
4
4
|
* MIT License
|
|
5
5
|
*
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
*
|
|
26
26
|
*/
|
|
27
27
|
/*!
|
|
28
|
-
* Vditor v0.0.
|
|
28
|
+
* Vditor v0.0.8 - A markdown editor written in TypeScript.
|
|
29
29
|
*
|
|
30
30
|
* MIT License
|
|
31
31
|
*
|
|
@@ -1840,6 +1840,10 @@
|
|
|
1840
1840
|
pointer-events: none;
|
|
1841
1841
|
display: block;
|
|
1842
1842
|
}
|
|
1843
|
+
.vditor--linenumber .vditor-reset .vditor-line-highlight {
|
|
1844
|
+
background-color: #fff3cd !important;
|
|
1845
|
+
transition: background-color 0.3s ease-in-out;
|
|
1846
|
+
}
|
|
1843
1847
|
/* 数学右键菜单全局样式(参考 ECharts 菜单风格) */
|
|
1844
1848
|
.vditor-math-menu {
|
|
1845
1849
|
position: fixed;
|
|
@@ -1912,6 +1916,56 @@
|
|
|
1912
1916
|
user-select: text;
|
|
1913
1917
|
-webkit-user-select: text;
|
|
1914
1918
|
}
|
|
1919
|
+
.vditor-selection-popover {
|
|
1920
|
+
position: absolute;
|
|
1921
|
+
z-index: 4;
|
|
1922
|
+
display: none;
|
|
1923
|
+
padding: 0;
|
|
1924
|
+
border-radius: 12px;
|
|
1925
|
+
background-color: var(--panel-background-color);
|
|
1926
|
+
box-shadow: var(--panel-shadow);
|
|
1927
|
+
border: 1px solid var(--border-color);
|
|
1928
|
+
-webkit-user-select: none;
|
|
1929
|
+
-moz-user-select: none;
|
|
1930
|
+
user-select: none;
|
|
1931
|
+
white-space: nowrap;
|
|
1932
|
+
transform-origin: top left;
|
|
1933
|
+
transition: opacity 150ms cubic-bezier(0.2, 0, 0.13, 1.5), transform 150ms cubic-bezier(0.2, 0, 0.13, 1.5);
|
|
1934
|
+
display: flex;
|
|
1935
|
+
align-items: center;
|
|
1936
|
+
}
|
|
1937
|
+
.vditor-selection-popover__btn {
|
|
1938
|
+
display: flex;
|
|
1939
|
+
align-items: center;
|
|
1940
|
+
justify-content: center;
|
|
1941
|
+
height: 32px;
|
|
1942
|
+
width: 109px;
|
|
1943
|
+
flex: 0 0 109px;
|
|
1944
|
+
box-sizing: border-box;
|
|
1945
|
+
white-space: nowrap;
|
|
1946
|
+
margin: 0 0px;
|
|
1947
|
+
border: none;
|
|
1948
|
+
background: transparent;
|
|
1949
|
+
color: var(--textarea-text-color);
|
|
1950
|
+
cursor: pointer;
|
|
1951
|
+
border-radius: 8px;
|
|
1952
|
+
outline: none;
|
|
1953
|
+
font-size: 14px;
|
|
1954
|
+
font-weight: 500;
|
|
1955
|
+
transition: all 0.15s ease-in-out;
|
|
1956
|
+
}
|
|
1957
|
+
.vditor-selection-popover__btn:hover,
|
|
1958
|
+
.vditor-selection-popover__btn:focus {
|
|
1959
|
+
color: var(--toolbar-icon-hover-color);
|
|
1960
|
+
background-color: transparent;
|
|
1961
|
+
}
|
|
1962
|
+
.vditor-selection-popover__btn[disabled] {
|
|
1963
|
+
opacity: 0.9;
|
|
1964
|
+
cursor: not-allowed;
|
|
1965
|
+
}
|
|
1966
|
+
.vditor-selection-popover__btn + .vditor-selection-popover__btn {
|
|
1967
|
+
border-left: 1px solid var(--border-color);
|
|
1968
|
+
}
|
|
1915
1969
|
details > summary {
|
|
1916
1970
|
list-style: none;
|
|
1917
1971
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -22,7 +22,16 @@ declare class Vditor extends VditorMethod {
|
|
|
22
22
|
* - 依赖配置 `lineNumber: true`,关闭时直接跳过以提升性能
|
|
23
23
|
* @param immediate 为 true 时立即更新;默认为节流更新以避免频繁调用
|
|
24
24
|
*/
|
|
25
|
+
/** 手动更新行号 */
|
|
25
26
|
updateLineNumbers(immediate?: boolean): void;
|
|
27
|
+
/**
|
|
28
|
+
* 高亮指定行号对应的块元素
|
|
29
|
+
* - 仅匹配拥有 `data-linenumber`/`data-lineNumber` 且值等于指定行号的元素
|
|
30
|
+
* - 应用高亮样式并在约 500ms 后自动恢复
|
|
31
|
+
* @param numbers 要高亮的行号数组
|
|
32
|
+
*/
|
|
33
|
+
/** 高亮指定行号,时长受 `options.lineNumber.highlightTimer` 控制 */
|
|
34
|
+
setLinehightNumbers(numbers: number[]): void;
|
|
26
35
|
/** 获取编辑器当前编辑模式 */
|
|
27
36
|
getCurrentMode(): "sv" | "wysiwyg" | "ir";
|
|
28
37
|
/** 聚焦到编辑器 */
|